package com.example.user.controller;

import com.example.user.pojo.User;
import com.example.user.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @BelongsProject: fourperiodtest
 * @BelongsPackage: com.example.user.controller
 * @Author: 江岸
 * @CreateTime: 2020-06-30 10:30
 * @Description:
 * 网址:http://localhost:6060/swagger-ui.html#
 */
@Api(value = "User模块接口",description = "这是一个用户模块的接口文档")
@RestController
public class UserController {
    @Autowired
    private UserService userService;

    @ApiOperation("根据用户名密码注册")
    @PostMapping("register")
    public String register(@Valid User user){
        String register = userService.register(user);
        return  register;
    }

    @ApiOperation("根据用户名密码登录")
    @PostMapping("login")
    public String login(@Valid User user){
        String login = userService.login(user);
        return  login;
    }
}
